<?php
// 配置键，用于统一标识当前组件配置
$configKey = isset($configKey) ? $configKey : 'digital_marketing';

$texts = [
    'process_title' => '我们的数字营销流程',
    'process_subtitle' => '系统化的营销执行流程，确保每一步都为您的业务增长创造价值',
    'case_studies_title' => '成功案例',
    'case_studies_subtitle' => '我们帮助各行业客户实现数字营销突破，取得显著业务增长',
    'view_full_case' => '查看完整案例',
    'browse_more_cases' => '浏览更多案例',
    'pricing_title' => '数字营销服务定价',
    'pricing_subtitle' => '灵活的服务套餐满足不同阶段企业的需求，数据驱动确保投资回报',
    'select_plan' => '选择此方案',
    'custom_plan_text' => '需要定制化营销方案？联系我们获取专属方案',
    'team_advantages_title' => '为什么选择我们的营销团队',
    'team_advantages_subtitle' => '我们拥有资深营销专家和丰富的实战经验，帮助企业在数字时代脱颖而出',
    'form_company' => '公司名称',
    'form_contact_name' => '联系人姓名',
    'form_phone' => '联系电话',
    'form_email' => '电子邮箱',
    'form_marketing_needs' => '您的营销需求',
    'form_select_need' => '请选择您的主要需求',
    'form_comprehensive' => '综合数字营销服务',
    'form_audit' => '营销效果审计与优化',
    'form_current_situation' => '当前营销状况',
    'form_situation_placeholder' => '请简要描述您目前的营销情况和面临的挑战...',
    'form_privacy_accept' => '我同意贵公司根据隐私政策处理我的个人信息',
    'form_privacy_link_text' => '隐私政策',
    'form_submit_success' => '您的申请已提交成功！我们的营销专家将在24小时内与您联系。',
    'form_submit_error' => '提交过程中出现错误，请检查表单并重新提交。',
    'form_required_mark' => '*',
    'form_validation_required' => '此字段为必填项',
    'form_validation_min_length' => '至少需要{min}个字符',
    'form_validation_max_length' => '最多可输入{max}个字符',
    'form_validation_phone' => '请输入有效的手机号码',
    'form_validation_email' => '请输入有效的电子邮箱'
];

// CSS类名配置，统一管理样式类
$classes = [
    'section' => 'py-16',
    'container' => 'mx-auto px-4 sm:px-6 lg:px-8',
    'section_header' => 'text-center max-w-3xl mx-auto mb-16',
    'section_pretitle' => 'inline-block text-sm font-semibold text-blue-600 uppercase tracking-wider mb-2',
    'section_title' => 'text-3xl md:text-4xl font-bold text-gray-900 mb-4',
    'section_subtitle' => 'text-lg text-gray-600',
    'card_base' => 'p-8 rounded-xl transition-all duration-300 h-full',
    'card_modern' => 'bg-white shadow-md hover:shadow-xl hover:-translate-y-1',
    'card_classic' => 'bg-white border border-gray-200 hover:border-primary',
    'card_minimal' => 'bg-transparent hover:bg-gray-50',
    'service_grid' => 'grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8 mb-20',
    'service_icon_container' => 'w-16 h-16 rounded-lg flex items-center justify-center mb-6 text-2xl transition-transform duration-500 group-hover:scale-110',
    'service_title' => 'text-xl font-semibold mb-3 text-gray-900 transition-colors duration-300',
    'service_description' => 'text-gray-600 mb-6',
    'service_features' => 'space-y-2 mb-6',
    'service_feature_item' => 'flex items-center text-sm text-gray-700',
    'service_results' => 'p-4 rounded-lg border border-gray-200 mb-6',
    'service_results_title' => 'text-sm font-medium text-gray-900 mb-3',
    'service_results_grid' => 'grid grid-cols-2 gap-3',
    'service_result_metric' => 'text-xs text-gray-500',
    'service_result_value' => 'text-lg font-bold',
    'service_case' => 'text-sm text-gray-700 italic',
    'process_section' => 'max-w-5xl mx-auto mb-20',
    'process_header' => 'text-center mb-16',
    'process_container' => 'relative',
    'process_line' => 'hidden md:block absolute top-1/2 left-0 right-0 h-1 bg-gray-200 -translate-y-1/2 z-0',
    'process_steps' => 'grid grid-cols-1 md:grid-cols-4 gap-8 relative z-10',
    'process_step' => 'flex flex-col items-center text-center',
    'process_step_number' => 'w-16 h-16 rounded-full text-blue-600 flex items-center justify-center text-2xl font-bold mb-4 border-2 border-blue-100 shadow-sm',
    'process_step_title' => 'text-xl font-semibold mb-2 text-gray-900',
    'process_step_description' => 'text-gray-600',
    'case_studies_section' => 'max-w-6xl mx-auto mb-20',
    'case_studies_header' => 'text-center mb-16',
    'case_grid' => 'grid grid-cols-1 lg:grid-cols-2 gap-8',
    'case_card' => 'rounded-xl shadow-sm overflow-hidden hover:shadow-md transition-all duration-300 border border-gray-100',
    'case_image' => 'h-48 w-full object-cover lg:h-full lg:w-full',
    'case_industry' => 'text-sm font-semibold text-blue-600 mb-2',
    'case_title' => 'text-2xl font-bold text-gray-900 mb-3',
    'case_section_title' => 'text-sm font-semibold text-gray-900 mb-1',
    'case_section_content' => 'text-gray-600 text-sm',
    'case_results' => 'text-sm text-gray-700 space-y-1',
    'case_result_item' => 'flex items-center',
    'case_link' => 'inline-flex items-center text-blue-600 hover:text-blue-800 font-medium mt-6',
    'more_cases_button' => 'inline-flex items-center px-6 py-3 border-2 border-blue-500 text-base font-medium rounded-md text-blue-600 hover:bg-blue-50 transition-colors duration-300 mt-10',
    'pricing_section' => 'max-w-5xl mx-auto mb-20',
    'pricing_header' => 'text-center mb-16',
    'pricing_grid' => 'grid grid-cols-1 md:grid-cols-3 gap-8',
    'pricing_card' => 'relative h-full',
    'pricing_recommended_badge' => 'absolute top-0 right-0 bg-blue-500 text-white text-xs font-bold px-3 py-1 rounded-bl-lg',
    'pricing_title' => 'text-2xl font-bold text-gray-900 mb-1',
    'pricing_subtitle' => 'text-gray-600 mb-6',
    'pricing_price' => 'text-4xl font-bold text-gray-900',
    'pricing_period' => 'text-gray-600 ml-1',
    'pricing_features' => 'space-y-3 mb-8',
    'pricing_feature' => 'flex items-start',
    'pricing_feature_icon' => 'fa fa-check text-green-500 mt-1 mr-3',
    'pricing_feature_text' => 'text-gray-700',
    'pricing_button' => 'block w-full py-3 px-4 font-medium rounded-lg transition-all duration-300 text-center border-2',
    'pricing_button_recommended' => 'border-blue-600 text-blue-600 hover:bg-blue-50',
    'pricing_button_default' => 'border-gray-300 text-gray-700 hover:bg-gray-50',
    'pricing_footer_text' => 'text-center mt-10 text-gray-600',
    'pricing_footer_link' => 'text-blue-600 hover:underline font-medium',
    'team_section' => 'max-w-5xl mx-auto mb-20',
    'team_header' => 'text-center mb-16',
    'team_grid' => 'grid grid-cols-1 md:grid-cols-3 gap-8',
    'team_card' => 'border-2 border-gray-200 p-8 rounded-xl shadow-md hover:shadow-lg transition-all duration-300',
    'team_icon_container' => 'w-14 h-14 rounded-lg flex items-center justify-center mb-6 text-2xl',
    'team_title' => 'text-xl font-semibold mb-3 text-gray-900',
    'team_description' => 'text-gray-600',
    'form_section' => 'max-w-4xl mx-auto rounded-2xl overflow-hidden shadow-lg border border-gray-200',
    'form_grid' => 'grid grid-cols-1 lg:grid-cols-2',
    'form_info_panel' => 'p-8 lg:p-12 relative overflow-hidden',
    'form_info_decor_top' => 'absolute top-0 right-0 w-64 h-64 rounded-full -mr-32 -mt-32 border-2 border-gray-100',
    'form_info_decor_bottom' => 'absolute bottom-0 left-0 w-40 h-40 rounded-full -ml-20 -mb-20 border-2 border-gray-100',
    'form_info_title' => 'text-3xl font-bold mb-4 relative z-10',
    'form_info_subtitle' => 'mb-8 opacity-90 relative z-10',
    'form_info_features' => 'space-y-6 relative z-10',
    'form_info_feature' => 'flex items-start',
    'form_info_feature_icon' => 'flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center border-2 border-gray-200',
    'form_info_feature_text' => 'ml-4',
    'form_info_feature_title' => 'font-semibold mb-1',
    'form_info_feature_desc' => 'text-sm opacity-80',
    'form_panel' => 'p-8 lg:p-12',
    'form_success' => 'hidden mb-6 p-4 bg-green-50 border border-green-200 rounded-lg text-green-800',
    'form_error' => 'hidden mb-6 p-4 bg-red-50 border border-red-200 rounded-lg text-red-800',
    'form_message_icon' => 'mt-0.5 mr-3',
    'form_message_text' => '',
    'form' => 'space-y-6',
    'form_group' => '',
    'form_label' => 'block text-gray-700 font-medium mb-2',
    'form_required' => 'text-red-500',
    'form_field' => 'w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-300',
    'form_select_wrapper' => 'relative',
    'form_select' => 'appearance-none',
    'form_select_arrow' => 'pointer-events-none absolute inset-y-0 right-0 flex items-center px-3 text-gray-500',
    'form_textarea' => '',
    'form_char_limit' => 'text-xs text-gray-500 mt-1',
    'form_checkbox_group' => 'flex items-start p-4 rounded-lg border border-gray-200 hover:border-blue-300 transition-colors duration-300',
    'form_checkbox' => 'w-5 h-5 text-blue-600 focus:ring-blue-500 border-gray-300 rounded',
    'form_checkbox_label' => 'ml-3 text-sm text-gray-700',
    'form_checkbox_link' => 'text-blue-600 hover:underline',
    'form_submit_group' => 'pt-2',
    'form_submit_button' => 'w-full py-3 px-4 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-all duration-300 shadow hover:shadow-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2',
    'form_submit_text' => '',
    'form_loading' => 'ml-2 hidden',
    'form_error_message' => 'text-red-500 text-sm hidden'
];

// 数字营销服务配置
$defaultConfig = [
    'section_id' => $configKey,
    'section_pretitle' => '增长引擎',
    'section_title' => '数字营销解决方案',
    'section_subtitle' => '通过数据驱动的营销策略，帮助企业提升品牌影响力和市场转化率',
    'bg_color' => 'gray-50',
    'card_style' => 'modern', // modern, classic, minimal
    'texts' => $texts,
    'classes' => $classes,
    'services' => [
        [
            'id' => 'seo',
            'title' => '搜索引擎优化',
            'description' => '提升网站在搜索引擎中的自然排名，获取高质量有机流量',
            'icon' => 'fa-search',
            'accent_color' => 'green-600',
            'features' => [
                '技术SEO审计',
                '关键词策略规划',
                '内容优化与创建',
                '链接建设策略',
                '排名与流量监控'
            ],
            'results' => [
                '平均排名提升' => '72%',
                '有机流量增长' => '156%',
                '转化提升' => '43%'
            ],
            'case_study' => '某电商平台6个月内有机流量增长156%，转化率提升43%'
        ],
        [
            'id' => 'sem',
            'title' => '搜索引擎营销',
            'description' => '通过精准的付费搜索广告，快速获取高质量目标客户',
            'icon' => 'fa-google',
            'accent_color' => 'blue-600',
            'features' => [
                '关键词研究与选择',
                '广告文案优化',
                '着陆页转化率提升',
                '竞价策略管理',
                'ROI分析与优化'
            ],
            'results' => [
                '平均CPC降低' => '28%',
                '点击率提升' => '65%',
                '转化成本降低' => '34%'
            ],
            'case_study' => '某SaaS企业通过优化SEM策略，获客成本降低34%，ROI提升127%'
        ],
        [
            'id' => 'social',
            'title' => '社交媒体营销',
            'description' => '在主流社交平台建立品牌影响力，培养用户社群与忠诚度',
            'icon' => 'fa-share-alt',
            'accent_color' => 'purple-600',
            'features' => [
                '社交平台策略规划',
                '内容日历与创作',
                '社群运营与互动',
                '社交广告投放',
                'KOL合作管理'
            ],
            'results' => [
                '粉丝增长' => '215%',
                '互动率提升' => '89%',
                '社交引流' => '132%'
            ],
            'case_study' => '某消费品牌通过系统化社交媒体运营，粉丝量6个月增长215%'
        ],
        [
            'id' => 'content',
            'title' => '内容营销',
            'description' => '创建有价值的内容资产，吸引目标受众并建立行业权威',
            'icon' => 'fa-file-text',
            'accent_color' => 'orange-600',
            'features' => [
                '内容策略制定',
                '博客与文章创作',
                '视频与多媒体内容',
                '内容分发与推广',
                '效果追踪与优化'
            ],
            'results' => [
                '内容覆盖人群' => '50万+',
                '内容转化率' => '18%',
                '品牌提及增长' => '143%'
            ],
            'case_study' => '某B2B企业通过内容营销，建立行业权威地位，线索量提升129%'
        ]
    ],
    'process' => [
        [
            'step' => 1,
            'title' => '战略诊断',
            'description' => '分析企业现状、目标受众与市场竞争格局，明确营销机会'
        ],
        [
            'step' => 2,
            'title' => '方案制定',
            'description' => '基于数据洞察，制定个性化数字营销组合策略与执行计划'
        ],
        [
            'step' => 3,
            'title' => '执行优化',
            'description' => '多渠道协同执行，实时监控数据表现，持续优化营销效果'
        ],
        [
            'step' => 4,
            'title' => '效果扩大',
            'description' => '复制成功经验，扩大营销规模，实现可持续的业务增长'
        ]
    ],
    'case_studies' => [
        [
            'id' => 'ecommerce',
            'title' => '电商平台流量与转化提升',
            'industry' => '电子商务',
            'challenge' => '新上线电商平台面临流量不足、转化率低的问题',
            'solution' => '整合SEO、内容营销与社交媒体推广的全渠道营销策略',
            'results' => [
                '6个月内月访问量增长230%',
                '转化率提升67%',
                '客单价提高32%'
            ],
            'image' => 'https://picsum.photos/seed/ecommerce/800/500',
            'image_alt' => '电商平台营销案例数据展示'
        ],
        [
            'id' => 'saas',
            'title' => 'SaaS产品获客成本优化',
            'industry' => '软件即服务',
            'challenge' => '获客成本持续上升，营销ROI不断下降',
            'solution' => '重构SEM策略，优化着陆页，建立内容营销体系',
            'results' => [
                '获客成本降低41%',
                '试用转化率提升53%',
                '营销ROI提升189%'
            ],
            'image' => 'https://picsum.photos/seed/saas/800/500',
            'image_alt' => 'SaaS产品营销效果对比'
        ]
    ],
    'pricing' => [
        [
            'id' => 'starter',
            'title' => '起步套餐',
            'subtitle' => '适合初创企业与小型团队',
            'price' => 12800,
            'period' => '月',
            'features' => [
                '2个核心营销渠道',
                '基础内容创作（4篇/月）',
                '月度数据分析报告',
                '1次月度策略调整',
                '邮件技术支持'
            ],
            'recommended' => false
        ],
        [
            'id' => 'growth',
            'title' => '增长套餐',
            'subtitle' => '适合快速发展中的企业',
            'price' => 29800,
            'period' => '月',
            'features' => [
                '4个整合营销渠道',
                '全类型内容创作（12篇/月）',
                '双周数据分析报告',
                '持续策略优化',
                '专属营销顾问',
                '优先级技术支持'
            ],
            'recommended' => true
        ],
        [
            'id' => 'enterprise',
            'title' => '企业定制',
            'subtitle' => '适合大型企业复杂需求',
            'price' => 68000,
            'period' => '月起',
            'features' => [
                '全渠道整合营销',
                '定制化内容策略与创作',
                '实时数据监控与周报',
                '专属营销团队',
                '战略级营销规划',
                '竞品持续分析',
                '营销自动化实施'
            ],
            'recommended' => false
        ]
    ],
    'team_advantages' => [
        [
            'icon' => 'fa-bar-chart',
            'bg_color' => 'blue-100',
            'text_color' => 'blue-600',
            'title' => '数据驱动决策',
            'description' => '基于数据分析制定营销策略，持续优化营销效果，确保每一分投入都产生最大回报'
        ],
        [
            'icon' => 'fa-users',
            'title' => '资深专家团队',
            'description' => '平均8年以上行业经验，熟悉各行业营销特点，能快速找到最适合您的营销方案'
        ],
        [
            'icon' => 'fa-cogs',
            'title' => '全渠道整合能力',
            'description' => '打通各营销渠道，实现数据与策略的协同，避免单一渠道依赖风险'
        ]
    ],
    'cta' => [
        'title' => '准备好提升您的数字营销效果了吗？',
        'subtitle' => '免费获取定制化数字营销评估报告，发现增长机会',
        'button_text' => '获取免费评估',
        'form_action' => '/submit-marketing.php',
        'features' => [
            [
                'icon' => 'fa-line-chart',
                'title' => '数据化分析',
                'description' => '基于您当前营销状况的专业数据分析'
            ],
            [
                'icon' => 'fa-lightbulb-o',
                'title' => '定制化建议',
                'description' => '针对您业务特点的个性化营销方案建议'
            ],
            [
                'icon' => 'fa-rocket',
                'title' => '增长路线图',
                'description' => '清晰的营销实施步骤与预期效果评估'
            ]
        ]
    ]
];

// 合并配置
$data = array_merge($defaultConfig, $pageConfig['components'][$configKey] ?? []);

// 处理背景样式
$bgClass = "bg-{$data['bg_color']}";

// 处理卡片样式
$cardClass = $data['classes']['card_base'] . ' ' . $data['classes']["card_{$data['card_style']}"];
?>

<!-- 数字营销服务页面 -->
<section id="<?php echo htmlspecialchars($data['section_id']); ?>" class="<?php echo $bgClass; ?> <?php echo $data['classes']['section']; ?>">
    <div class="<?php echo $data['classes']['container']; ?>">
        <!-- 区域标题 -->
        <div class="<?php echo $data['classes']['section_header']; ?>">
            <?php if (!empty($data['section_pretitle'])): ?>
                <span class="<?php echo $data['classes']['section_pretitle']; ?>">
                    <?php echo htmlspecialchars($data['section_pretitle']); ?>
                </span>
            <?php endif; ?>
            
            <h2 class="<?php echo $data['classes']['section_title']; ?>">
                <?php echo htmlspecialchars($data['section_title']); ?>
            </h2>
            
            <?php if (!empty($data['section_subtitle'])): ?>
                <p class="<?php echo $data['classes']['section_subtitle']; ?>">
                    <?php echo htmlspecialchars($data['section_subtitle']); ?>
                </p>
            <?php endif; ?>
        </div>

        <!-- 营销服务类型 -->
        <div class="<?php echo $data['classes']['service_grid']; ?>">
            <?php foreach ($data['services'] as $service): ?>
                <div class="<?php echo $cardClass; ?> group" data-service-card>
                    <!-- 图标容器 -->
                    <div class="<?php echo $data['classes']['service_icon_container']; ?> bg-<?php echo $service['accent_color']; ?>/10 text-<?php echo $service['accent_color']; ?>">
                        <i class="fa <?php echo htmlspecialchars($service['icon']); ?>"></i>
                    </div>
                    
                    <!-- 服务信息 -->
                    <h3 class="<?php echo $data['classes']['service_title']; ?> group-hover:text-<?php echo $service['accent_color']; ?>">
                        <?php echo htmlspecialchars($service['title']); ?>
                    </h3>
                    
                    <p class="<?php echo $data['classes']['service_description']; ?>">
                        <?php echo htmlspecialchars($service['description']); ?>
                    </p>
                    
                    <!-- 服务特点 -->
                    <ul class="<?php echo $data['classes']['service_features']; ?>">
                        <?php foreach ($service['features'] as $feature): ?>
                            <li class="<?php echo $data['classes']['service_feature_item']; ?>">
                                <i class="fa fa-check text-<?php echo $service['accent_color']; ?> mr-2"></i>
                                <?php echo htmlspecialchars($feature); ?>
                            </li>
                        <?php endforeach; ?>
                    </ul>
                    
                    <!-- 服务成果 -->
                    <div class="<?php echo $data['classes']['service_results']; ?>">
                        <h4 class="<?php echo $data['classes']['service_results_title']; ?>">典型成果</h4>
                        <div class="<?php echo $data['classes']['service_results_grid']; ?>">
                            <?php foreach ($service['results'] as $metric => $value): ?>
                                <div>
                                    <div class="<?php echo $data['classes']['service_result_metric']; ?>"><?php echo htmlspecialchars($metric); ?></div>
                                    <div class="<?php echo $data['classes']['service_result_value']; ?> text-<?php echo $service['accent_color']; ?>"><?php echo htmlspecialchars($value); ?></div>
                                </div>
                            <?php endforeach; ?>
                        </div>
                    </div>
                    
                    <!-- 案例简述 -->
                    <p class="<?php echo $data['classes']['service_case']; ?>">
                        "<?php echo htmlspecialchars($service['case_study']); ?>"
                    </p>
                </div>
            <?php endforeach; ?>
        </div>
        
        <!-- 营销流程 -->
        <div class="<?php echo $data['classes']['process_section']; ?>">
            <div class="<?php echo $data['classes']['process_header']; ?>">
                <h2 class="<?php echo $data['classes']['section_title']; ?>"><?php echo htmlspecialchars($data['texts']['process_title']); ?></h2>
                <p class="<?php echo $data['classes']['section_subtitle']; ?> max-w-3xl mx-auto">
                    <?php echo htmlspecialchars($data['texts']['process_subtitle']); ?>
                </p>
            </div>
            
            <div class="<?php echo $data['classes']['process_container']; ?>">
                <!-- 连接线 -->
                <div class="<?php echo $data['classes']['process_line']; ?>"></div>
                
                <div class="<?php echo $data['classes']['process_steps']; ?>">
                    <?php foreach ($data['process'] as $step): ?>
                        <div class="<?php echo $data['classes']['process_step']; ?>">
                            <div class="<?php echo $data['classes']['process_step_number']; ?>">
                                <?php echo $step['step']; ?>
                            </div>
                            <h3 class="<?php echo $data['classes']['process_step_title']; ?>"><?php echo htmlspecialchars($step['title']); ?></h3>
                            <p class="<?php echo $data['classes']['process_step_description']; ?>"><?php echo htmlspecialchars($step['description']); ?></p>
                        </div>
                    <?php endforeach; ?>
                </div>
            </div>
        </div>
        
        <!-- 成功案例 -->
        <div class="<?php echo $data['classes']['case_studies_section']; ?>">
            <div class="<?php echo $data['classes']['case_studies_header']; ?>">
                <h2 class="<?php echo $data['classes']['section_title']; ?>"><?php echo htmlspecialchars($data['texts']['case_studies_title']); ?></h2>
                <p class="<?php echo $data['classes']['section_subtitle']; ?> max-w-3xl mx-auto">
                    <?php echo htmlspecialchars($data['texts']['case_studies_subtitle']); ?>
                </p>
            </div>
            
            <div class="<?php echo $data['classes']['case_grid']; ?>">
                <?php foreach ($data['case_studies'] as $case): ?>
                    <div class="<?php echo $data['classes']['case_card']; ?>">
                        <div class="lg:flex">
                            <div class="lg:shrink-0 lg:w-1/2">
                                <img 
                                    class="<?php echo $data['classes']['case_image']; ?>" 
                                    src="<?php echo htmlspecialchars($case['image']); ?>" 
                                    alt="<?php echo htmlspecialchars($case['image_alt']); ?>"
                                >
                            </div>
                            <div class="p-8 lg:w-1/2">
                                <div class="<?php echo $data['classes']['case_industry']; ?>">
                                    <?php echo htmlspecialchars($case['industry']); ?>
                                </div>
                                <h3 class="<?php echo $data['classes']['case_title']; ?>">
                                    <?php echo htmlspecialchars($case['title']); ?>
                                </h3>
                                
                                <div class="mb-4">
                                    <h4 class="<?php echo $data['classes']['case_section_title']; ?>">挑战</h4>
                                    <p class="<?php echo $data['classes']['case_section_content']; ?>">
                                        <?php echo htmlspecialchars($case['challenge']); ?>
                                    </p>
                                </div>
                                
                                <div class="mb-4">
                                    <h4 class="<?php echo $data['classes']['case_section_title']; ?>">解决方案</h4>
                                    <p class="<?php echo $data['classes']['case_section_content']; ?>">
                                        <?php echo htmlspecialchars($case['solution']); ?>
                                    </p>
                                </div>
                                
                                <div>
                                    <h4 class="<?php echo $data['classes']['case_section_title']; ?>">成果</h4>
                                    <ul class="<?php echo $data['classes']['case_results']; ?>">
                                        <?php foreach ($case['results'] as $result): ?>
                                            <li class="<?php echo $data['classes']['case_result_item']; ?>">
                                                <i class="fa fa-arrow-up text-green-500 mr-2"></i>
                                                <?php echo htmlspecialchars($result); ?>
                                            </li>
                                        <?php endforeach; ?>
                                    </ul>
                                </div>
                                
                                <a href="/case-studies/<?php echo htmlspecialchars($case['id']); ?>" class="<?php echo $data['classes']['case_link']; ?>">
                                    <?php echo htmlspecialchars($data['texts']['view_full_case']); ?>
                                    <i class="fa fa-long-arrow-right ml-2"></i>
                                </a>
                            </div>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>
            
            <div class="text-center">
                <a href="/case-studies" class="<?php echo $data['classes']['more_cases_button']; ?>">
                    <?php echo htmlspecialchars($data['texts']['browse_more_cases']); ?>
                    <i class="fa fa-chevron-right ml-2"></i>
                </a>
            </div>
        </div>
        
        <!-- 营销定价 -->
        <div class="<?php echo $data['classes']['pricing_section']; ?>">
            <div class="<?php echo $data['classes']['pricing_header']; ?>">
                <h2 class="<?php echo $data['classes']['section_title']; ?>"><?php echo htmlspecialchars($data['texts']['pricing_title']); ?></h2>
                <p class="<?php echo $data['classes']['section_subtitle']; ?> max-w-3xl mx-auto">
                    <?php echo htmlspecialchars($data['texts']['pricing_subtitle']); ?>
                </p>
            </div>
            
            <div class="<?php echo $data['classes']['pricing_grid']; ?>">
                <?php foreach ($data['pricing'] as $package): ?>
                    <div class="<?php echo $cardClass; ?> <?php echo $data['classes']['pricing_card']; ?> <?php echo $package['recommended'] ? 'border-2 border-blue-500 scale-105 z-10' : ''; ?>">
                        <?php if ($package['recommended']): ?>
                            <div class="<?php echo $data['classes']['pricing_recommended_badge']; ?>">
                                推荐
                            </div>
                        <?php endif; ?>
                        
                        <h3 class="<?php echo $data['classes']['pricing_title']; ?>"><?php echo htmlspecialchars($package['title']); ?></h3>
                        <p class="<?php echo $data['classes']['pricing_subtitle']; ?>"><?php echo htmlspecialchars($package['subtitle']); ?></p>
                        
                        <div class="mb-6">
                            <span class="<?php echo $data['classes']['pricing_price']; ?>">¥<?php echo number_format($package['price']); ?></span>
                            <span class="<?php echo $data['classes']['pricing_period']; ?>"><?php echo htmlspecialchars($package['period']); ?></span>
                        </div>
                        
                        <ul class="<?php echo $data['classes']['pricing_features']; ?>">
                            <?php foreach ($package['features'] as $feature): ?>
                                <li class="<?php echo $data['classes']['pricing_feature']; ?>">
                                    <i class="<?php echo $data['classes']['pricing_feature_icon']; ?>"></i>
                                    <span class="<?php echo $data['classes']['pricing_feature_text']; ?>"><?php echo htmlspecialchars($feature); ?></span>
                                </li>
                            <?php endforeach; ?>
                        </ul>
                        
                        <a href="#marketing-form" class="<?php echo $data['classes']['pricing_button']; ?> <?php echo $package['recommended'] ? $data['classes']['pricing_button_recommended'] : $data['classes']['pricing_button_default']; ?>">
                            <?php echo htmlspecialchars($data['texts']['select_plan']); ?>
                        </a>
                    </div>
                <?php endforeach; ?>
            </div>
            
            <div class="<?php echo $data['classes']['pricing_footer_text']; ?>">
                <?php echo str_replace('联系我们', '<a href="#marketing-form" class="' . $data['classes']['pricing_footer_link'] . '">联系我们</a>', $data['texts']['custom_plan_text']); ?>
            </div>
        </div>
        
        <!-- 营销团队优势 -->
        <div class="<?php echo $data['classes']['team_section']; ?>">
            <div class="<?php echo $data['classes']['team_header']; ?>">
                <h2 class="<?php echo $data['classes']['section_title']; ?>"><?php echo htmlspecialchars($data['texts']['team_advantages_title']); ?></h2>
                <p class="<?php echo $data['classes']['section_subtitle']; ?> max-w-3xl mx-auto">
                    <?php echo htmlspecialchars($data['texts']['team_advantages_subtitle']); ?>
                </p>
            </div>
            
            <div class="<?php echo $data['classes']['team_grid']; ?>">
                <?php foreach ($data['team_advantages'] as $advantage): ?>
                    <div class="<?php echo $data['classes']['team_card']; ?>">
                        <div class="<?php echo $data['classes']['team_icon_container']; ?> bg-<?php echo $advantage['bg_color']; ?> text-<?php echo $advantage['text_color']; ?>">
                            <i class="fa <?php echo htmlspecialchars($advantage['icon']); ?>"></i>
                        </div>
                        <h3 class="<?php echo $data['classes']['team_title']; ?>"><?php echo htmlspecialchars($advantage['title']); ?></h3>
                        <p class="<?php echo $data['classes']['team_description']; ?>">
                            <?php echo htmlspecialchars($advantage['description']); ?>
                        </p>
                    </div>
                <?php endforeach; ?>
            </div>
        </div>
        
        <!-- 营销评估预约表单 -->
        <div id="marketing-form" class="<?php echo $data['classes']['form_section']; ?>">
            <div class="<?php echo $data['classes']['form_grid']; ?>">
                <!-- 表单信息 -->
                <div class="<?php echo $data['classes']['form_info_panel']; ?>">
                    <!-- 背景装饰 -->
                    <div class="<?php echo $data['classes']['form_info_decor_top']; ?>"></div>
                    <div class="<?php echo $data['classes']['form_info_decor_bottom']; ?>"></div>
                    
                    <h2 class="<?php echo $data['classes']['form_info_title']; ?>">
                        <?php echo htmlspecialchars($data['cta']['title']); ?>
                    </h2>
                    <p class="<?php echo $data['classes']['form_info_subtitle']; ?>">
                        <?php echo htmlspecialchars($data['cta']['subtitle']); ?>
                    </p>
                    
                    <div class="<?php echo $data['classes']['form_info_features']; ?>">
                        <?php foreach ($data['cta']['features'] as $feature): ?>
                            <div class="<?php echo $data['classes']['form_info_feature']; ?>">
                                <div class="<?php echo $data['classes']['form_info_feature_icon']; ?>">
                                    <i class="fa <?php echo htmlspecialchars($feature['icon']); ?>"></i>
                                </div>
                                <div class="<?php echo $data['classes']['form_info_feature_text']; ?>">
                                    <h4 class="<?php echo $data['classes']['form_info_feature_title']; ?>"><?php echo htmlspecialchars($feature['title']); ?></h4>
                                    <p class="<?php echo $data['classes']['form_info_feature_desc']; ?>"><?php echo htmlspecialchars($feature['description']); ?></p>
                                </div>
                            </div>
                        <?php endforeach; ?>
                    </div>
                </div>
                
                <!-- 表单 -->
                <div class="<?php echo $data['classes']['form_panel']; ?>">
                    <!-- 表单状态反馈 -->
                    <div id="marketingForm-success" class="<?php echo $data['classes']['form_success']; ?>">
                        <div class="flex">
                            <i class="fa fa-check-circle text-green-500 <?php echo $data['classes']['form_message_icon']; ?>"></i>
                            <span class="<?php echo $data['classes']['form_message_text']; ?>"><?php echo htmlspecialchars($data['texts']['form_submit_success']); ?></span>
                        </div>
                    </div>
                    
                    <div id="marketingForm-error" class="<?php echo $data['classes']['form_error']; ?>">
                        <div class="flex">
                            <i class="fa fa-exclamation-circle text-red-500 <?php echo $data['classes']['form_message_icon']; ?>"></i>
                            <span class="<?php echo $data['classes']['form_message_text']; ?>"><?php echo htmlspecialchars($data['texts']['form_submit_error']); ?></span>
                        </div>
                    </div>
                    
                    <form 
                        action="<?php echo htmlspecialchars($data['cta']['form_action']); ?>" 
                        method="post"
                        class="<?php echo $data['classes']['form']; ?>"
                        id="marketingForm"
                        novalidate
                    >
                        <div class="<?php echo $data['classes']['form_group']; ?>">
                            <label for="company" class="<?php echo $data['classes']['form_label']; ?>">
                                <?php echo htmlspecialchars($data['texts']['form_company']); ?> 
                                <span class="<?php echo $data['classes']['form_required']; ?>"><?php echo htmlspecialchars($data['texts']['form_required_mark']); ?></span>
                            </label>
                            <input 
                                type="text" 
                                id="company" 
                                name="company" 
                                required
                                data-validation='{"min_length":2,"max_length":100,"messages":{"required":"<?php echo addslashes($data['texts']['form_validation_required']); ?>","min_length":"<?php echo addslashes(str_replace('{min}', '{min_length}', $data['texts']['form_validation_min_length'])); ?>","max_length":"<?php echo addslashes(str_replace('{max}', '{max_length}', $data['texts']['form_validation_max_length'])); ?>"}}'
                                class="<?php echo $data['classes']['form_field']; ?>"
                                placeholder="<?php echo htmlspecialchars($data['texts']['form_company']); ?>"
                            >
                            <div class="<?php echo $data['classes']['form_error_message']; ?>" data-error-for="company"></div>
                        </div>
                        
                        <div class="<?php echo $data['classes']['form_group']; ?>">
                            <label for="contact_name" class="<?php echo $data['classes']['form_label']; ?>">
                                <?php echo htmlspecialchars($data['texts']['form_contact_name']); ?> 
                                <span class="<?php echo $data['classes']['form_required']; ?>"><?php echo htmlspecialchars($data['texts']['form_required_mark']); ?></span>
                            </label>
                            <input 
                                type="text" 
                                id="contact_name" 
                                name="contact_name" 
                                required
                                data-validation='{"min_length":2,"max_length":50,"messages":{"required":"<?php echo addslashes($data['texts']['form_validation_required']); ?>","min_length":"<?php echo addslashes(str_replace('{min}', '{min_length}', $data['texts']['form_validation_min_length'])); ?>","max_length":"<?php echo addslashes(str_replace('{max}', '{max_length}', $data['texts']['form_validation_max_length'])); ?>"}}'
                                class="<?php echo $data['classes']['form_field']; ?>"
                                placeholder="<?php echo htmlspecialchars($data['texts']['form_contact_name']); ?>"
                            >
                            <div class="<?php echo $data['classes']['form_error_message']; ?>" data-error-for="contact_name"></div>
                        </div>
                        
                        <div class="<?php echo $data['classes']['form_group']; ?>">
                            <label for="phone" class="<?php echo $data['classes']['form_label']; ?>">
                                <?php echo htmlspecialchars($data['texts']['form_phone']); ?> 
                                <span class="<?php echo $data['classes']['form_required']; ?>"><?php echo htmlspecialchars($data['texts']['form_required_mark']); ?></span>
                            </label>
                            <input 
                                type="tel" 
                                id="phone" 
                                name="phone" 
                                required
                                data-validation='{"pattern":"^1[3-9]\\d{9}$","messages":{"required":"<?php echo addslashes($data['texts']['form_validation_required']); ?>","pattern":"<?php echo addslashes($data['texts']['form_validation_phone']); ?>"}}'
                                class="<?php echo $data['classes']['form_field']; ?>"
                                placeholder="<?php echo htmlspecialchars($data['texts']['form_phone']); ?>"
                            >
                            <div class="<?php echo $data['classes']['form_error_message']; ?>" data-error-for="phone"></div>
                        </div>
                        
                        <div class="<?php echo $data['classes']['form_group']; ?>">
                            <label for="email" class="<?php echo $data['classes']['form_label']; ?>">
                                <?php echo htmlspecialchars($data['texts']['form_email']); ?> 
                                <span class="<?php echo $data['classes']['form_required']; ?>"><?php echo htmlspecialchars($data['texts']['form_required_mark']); ?></span>
                            </label>
                            <input 
                                type="email" 
                                id="email" 
                                name="email" 
                                required
                                data-validation='{"pattern":"^[^\s@]+@[^\s@]+\.[^\s@]+$","messages":{"required":"<?php echo addslashes($data['texts']['form_validation_required']); ?>","pattern":"<?php echo addslashes($data['texts']['form_validation_email']); ?>"}}'
                                class="<?php echo $data['classes']['form_field']; ?>"
                                placeholder="<?php echo htmlspecialchars($data['texts']['form_email']); ?>"
                            >
                            <div class="<?php echo $data['classes']['form_error_message']; ?>" data-error-for="email"></div>
                        </div>
                        
                        <div class="<?php echo $data['classes']['form_group']; ?>">
                            <label for="marketing_needs" class="<?php echo $data['classes']['form_label']; ?>">
                                <?php echo htmlspecialchars($data['texts']['form_marketing_needs']); ?> 
                                <span class="<?php echo $data['classes']['form_required']; ?>"><?php echo htmlspecialchars($data['texts']['form_required_mark']); ?></span>
                            </label>
                            <div class="<?php echo $data['classes']['form_select_wrapper']; ?>">
                                <select 
                                    id="marketing_needs" 
                                    name="marketing_needs" 
                                    required
                                    data-validation='{"messages":{"required":"<?php echo addslashes($data['texts']['form_validation_required']); ?>"}}'
                                    class="<?php echo $data['classes']['form_field']; ?> <?php echo $data['classes']['form_select']; ?>"
                                >
                                    <option value=""><?php echo htmlspecialchars($data['texts']['form_select_need']); ?></option>
                                    <?php foreach ($data['services'] as $service): ?>
                                        <option value="<?php echo $service['id']; ?>"><?php echo htmlspecialchars($service['title']); ?></option>
                                    <?php endforeach; ?>
                                    <option value="comprehensive"><?php echo htmlspecialchars($data['texts']['form_comprehensive']); ?></option>
                                    <option value="audit"><?php echo htmlspecialchars($data['texts']['form_audit']); ?></option>
                                </select>
                                <div class="<?php echo $data['classes']['form_select_arrow']; ?>">
                                    <i class="fa fa-chevron-down"></i>
                                </div>
                            </div>
                            <div class="<?php echo $data['classes']['form_error_message']; ?>" data-error-for="marketing_needs"></div>
                        </div>
                        
                        <div class="<?php echo $data['classes']['form_group']; ?>">
                            <label for="current_situation" class="<?php echo $data['classes']['form_label']; ?>">
                                <?php echo htmlspecialchars($data['texts']['form_current_situation']); ?>
                            </label>
                            <textarea 
                                id="current_situation" 
                                name="current_situation" 
                                rows="4"
                                data-validation='{"max_length":500,"messages":{"max_length":"<?php echo addslashes(str_replace('{max}', '{max_length}', $data['texts']['form_validation_max_length'])); ?>"}}'
                                class="<?php echo $data['classes']['form_field']; ?> <?php echo $data['classes']['form_textarea']; ?>"
                                placeholder="<?php echo htmlspecialchars($data['texts']['form_situation_placeholder']); ?>"
                            ></textarea>
                            <div class="<?php echo $data['classes']['form_error_message']; ?>" data-error-for="current_situation"></div>
                            <div class="<?php echo $data['classes']['form_char_limit']; ?>">最多可输入500个字符</div>
                        </div>
                        
                        <!-- 隐私政策同意 -->
                        <div class="<?php echo $data['classes']['form_group']; ?>">
                            <div class="<?php echo $data['classes']['form_checkbox_group']; ?>">
                                <div class="flex items-center h-5">
                                    <input 
                                        id="privacy_accept"
                                        name="privacy_accept"
                                        type="checkbox"
                                        required
                                        data-validation='{"messages":{"required":"<?php echo addslashes($data['texts']['form_validation_required']); ?>"}}'
                                        class="<?php echo $data['classes']['form_checkbox']; ?>"
                                    >
                                </div>
                                <div class="ml-3 text-sm">
                                    <label 
                                        for="privacy_accept" 
                                        class="<?php echo $data['classes']['form_checkbox_label']; ?>"
                                    >
                                        <?php echo str_replace('隐私政策', '<a href="/privacy-policy" class="' . $data['classes']['form_checkbox_link'] . '" target="_blank">' . htmlspecialchars($data['texts']['form_privacy_link_text']) . '</a>', $data['texts']['form_privacy_accept']); ?>
                                        <span class="<?php echo $data['classes']['form_required']; ?>"><?php echo htmlspecialchars($data['texts']['form_required_mark']); ?></span>
                                    </label>
                                </div>
                            </div>
                            <div class="<?php echo $data['classes']['form_error_message']; ?>" data-error-for="privacy_accept"></div>
                        </div>
                        
                        <div class="<?php echo $data['classes']['form_submit_group']; ?>">
                            <button 
                                type="submit" 
                                class="<?php echo $data['classes']['form_submit_button']; ?>"
                                id="marketingForm-submit"
                            >
                                <span id="marketingForm-submit-text" class="<?php echo $data['classes']['form_submit_text']; ?>"><?php echo htmlspecialchars($data['cta']['button_text']); ?></span>
                                <i class="fa fa-paper-plane ml-2"></i>
                                <div id="marketingForm-loading" class="<?php echo $data['classes']['form_loading']; ?>">
                                    <i class="fa fa-spinner fa-spin"></i>
                                </div>
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</section>

<!-- 数字营销服务交互脚本 -->
<script>
document.addEventListener('DOMContentLoaded', function() {
    // 服务卡片动画
    const serviceCards = document.querySelectorAll('[data-service-card]');
    const observer = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.style.opacity = '1';
                entry.target.style.transform = 'translateY(0)';
                observer.unobserve(entry.target);
            }
        });
    }, { threshold: 0.1 });
    
    serviceCards.forEach((card, index) => {
        card.style.opacity = '0';
        card.style.transform = 'translateY(30px)';
        card.style.transition = `opacity 0.5s ease ${index * 0.1}s, transform 0.5s ease ${index * 0.1}s`;
        observer.observe(card);
    });
    
    // 流程步骤动画
    const processSteps = document.querySelectorAll('.<?php echo $data['classes']['process_step']; ?>');
    const processObserver = new IntersectionObserver((entries) => {
        entries.forEach(entry => {
            if (entry.isIntersecting) {
                entry.target.style.opacity = '1';
                entry.target.style.transform = 'translateY(0)';
                processObserver.unobserve(entry.target);
            }
        });
    }, { threshold: 0.2 });
    
    processSteps.forEach((step, index) => {
        step.style.opacity = '0';
        step.style.transform = 'translateY(20px)';
        step.style.transition = `opacity 0.5s ease ${index * 0.15}s, transform 0.5s ease ${index * 0.15}s`;
        processObserver.observe(step);
    });
    
    // 表单配置
    const formConfig = {
        formId: 'marketingForm',
        realTimeValidation: true,
        scrollToError: true,
        resetFormAfterSuccess: true,
        loadingIndicator: true,
        submitLoadingText: '提交中',
        submitText: <?php echo json_encode($data['cta']['button_text']); ?>,
        defaultFieldError: '请检查此字段'
    };

    // 获取表单元素
    const form = document.getElementById(formConfig.formId);
    if (!form) return;
    
    const submitButton = document.getElementById(`${formConfig.formId}-submit`);
    const submitText = document.getElementById(`${formConfig.formId}-submit-text`);
    const loadingIndicator = formConfig.loadingIndicator ? document.getElementById(`${formConfig.formId}-loading`) : null;
    const successMessage = document.getElementById(`${formConfig.formId}-success`);
    const errorMessage = document.getElementById(`${formConfig.formId}-error`);

    /**
     * 重置表单状态
     */
    function resetFormState() {
        if (successMessage) successMessage.classList.add('hidden');
        if (errorMessage) errorMessage.classList.add('hidden');
        
        form.querySelectorAll('.<?php echo $data['classes']['form_group']; ?>').forEach(group => {
            const input = group.querySelector('input, textarea, select');
            const errorEl = group.querySelector(`[data-error-for="${input?.name}"]`);
            
            if (input) input.classList.remove('border-red-500', 'focus:ring-red-500');
            if (errorEl) {
                errorEl.textContent = '';
                errorEl.classList.add('hidden');
            }
        });
    }

    /**
     * 显示字段错误
     */
    function showFieldError(field, message) {
        const formGroup = field.closest('.<?php echo $data['classes']['form_group']; ?>');
        const errorEl = formGroup.querySelector(`[data-error-for="${field.name}"]`);
        
        field.classList.add('border-red-500', 'focus:ring-red-500');
        
        if (errorEl) {
            errorEl.textContent = message;
            errorEl.classList.remove('hidden');
        }
    }

    /**
     * 清除字段错误
     */
    function clearFieldError(field) {
        const formGroup = field.closest('.<?php echo $data['classes']['form_group']; ?>');
        const errorEl = formGroup.querySelector(`[data-error-for="${field.name}"]`);
        
        field.classList.remove('border-red-500', 'focus:ring-red-500');
        
        if (errorEl) {
            errorEl.textContent = '';
            errorEl.classList.add('hidden');
        }
    }

    /**
     * 验证单个字段
     */
    function validateField(field) {
        const validation = field.dataset.validation ? JSON.parse(field.dataset.validation) : {};
        const value = field.type === 'checkbox' ? field.checked : (field.value || '').trim();
        let isValid = true;
        let errorMsg = formConfig.defaultFieldError;

        // 获取验证消息，使用自定义消息或默认消息
        const getMessage = (type, params = {}) => {
            if (validation.messages && validation.messages[type]) {
                let msg = validation.messages[type];
                Object.keys(params).forEach(key => {
                    msg = msg.replace(`{${key}}`, params[key]);
                });
                return msg;
            }
            return errorMsg;
        };

        // 必填验证
        if (field.required && !value) {
            isValid = false;
            errorMsg = getMessage('required');
        }
        // 最小长度验证
        else if (validation.min_length && value.length < validation.min_length) {
            isValid = false;
            errorMsg = getMessage('min_length', { min_length: validation.min_length });
        }
        // 最大长度验证
        else if (validation.max_length && value.length > validation.max_length) {
            isValid = false;
            errorMsg = getMessage('max_length', { max_length: validation.max_length });
        }
        // 正则表达式验证
        else if (validation.pattern && value && !new RegExp(validation.pattern).test(value)) {
            isValid = false;
            errorMsg = getMessage('pattern');
        }

        if (isValid) {
            clearFieldError(field);
        } else {
            showFieldError(field, errorMsg);
        }

        return isValid;
    }

    /**
     * 验证整个表单
     */
    function validateForm() {
        let isFormValid = true;
        const fields = form.querySelectorAll('input, textarea, select');

        fields.forEach(field => {
            if (!validateField(field)) {
                isFormValid = false;
            }
        });

        // 滚动到第一个错误字段
        if (!isFormValid && formConfig.scrollToError) {
            const firstErrorField = form.querySelector('.border-red-500');
            if (firstErrorField) {
                firstErrorField.scrollIntoView({ behavior: 'smooth', block: 'center' });
                firstErrorField.focus();
            }
        }

        return isFormValid;
    }

    /**
     * 绑定实时验证事件
     */
    if (formConfig.realTimeValidation) {
        const fields = form.querySelectorAll('input, textarea, select');
        
        fields.forEach(field => {
            // 输入和失焦事件触发验证
            field.addEventListener('input', () => validateField(field));
            field.addEventListener('blur', () => validateField(field));
            
            // 复选框变化时触发验证
            if (field.type === 'checkbox') {
                field.addEventListener('change', () => validateField(field));
            }
        });
    }

    /**
     * 表单提交处理
     */
    form.addEventListener('submit', async function(e) {
        e.preventDefault();
        resetFormState();

        // 客户端表单验证
        if (!validateForm()) {
            return;
        }

        // 显示加载状态
        if (submitButton) submitButton.disabled = true;
        if (submitText) submitText.textContent = formConfig.submitLoadingText;
        if (loadingIndicator) loadingIndicator.classList.remove('hidden');

        try {
            // 构建表单数据
            const formData = new FormData(form);

            // 提交表单（实际项目中替换为真实接口请求）
            // 这里使用模拟数据
            const response = await new Promise(resolve => {
                setTimeout(() => {
                    resolve({
                        ok: true,
                        json: () => Promise.resolve({ success: true })
                    });
                }, 1500);
            });

            const result = await response.json();

            // 处理提交结果
            if (response.ok && result.success) {
                // 提交成功
                if (successMessage) {
                    successMessage.classList.remove('hidden');
                    successMessage.scrollIntoView({ behavior: 'smooth', block: 'start' });
                }
                // 重置表单
                if (formConfig.resetFormAfterSuccess) form.reset();
            } else {
                // 提交失败
                if (errorMessage) errorMessage.classList.remove('hidden');
            }
        } catch (error) {
            // 处理网络错误
            console.error('表单提交错误:', error);
            if (errorMessage) errorMessage.classList.remove('hidden');
        } finally {
            // 恢复表单状态
            if (submitButton) submitButton.disabled = false;
            if (submitText) submitText.textContent = formConfig.submitText;
            if (loadingIndicator) loadingIndicator.classList.add('hidden');
        }
    });
    
    // 平滑滚动
    document.querySelectorAll('a[href^="#"]').forEach(anchor => {
        anchor.addEventListener('click', function(e) {
            e.preventDefault();
            
            const targetId = this.getAttribute('href');
            const targetElement = document.querySelector(targetId);
            
            if (targetElement) {
                targetElement.scrollIntoView({
                    behavior: 'smooth',
                    block: 'start'
                });
            }
        });
    });
});
</script>
